import {ALL_DATA, ID_DATA} from "../../action-types/homeType";
import {httpGet} from "../../utils/fetchUtils";

let url = "cook/category?key=85bc93da0d7855b9e1d1c708145d0c3e";
let urlId = "/cook/index?key=85bc93da0d7855b9e1d1c708145d0c3e&cid=";

export function getAllData() {
    return dispatch => {
        httpGet(url, function (response) {
            dispatch({
                type: ALL_DATA,
                foodData: response
            });
        });
    };
}

export function getIdData(id) {
    return dispatch => {
        return httpGet(urlId + id, function (response) {
            dispatch({
                type: ID_DATA,
                idFoodData: response.data
            });
        });
    };
}
